﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ITAP.ShprossesBuilder.Modelling.Components;

namespace ITAP.ShprossesBuilder.Editor
{
    public enum DisperseTo
    {
        Rectangle,
        Diamond,
        RectangleWithShprosses,
        DiamondWithShprosses
    }

    public partial class DisperseShprossConnectorForm : Form
    {
        public bool DeleteParentShprossConnector
        {
            get
            {
                return checkBoxDeleteParentShprossConnector.Checked;
            }
        }

        public double Distance
        {
            get
            {
                return (double)numericUpDownDistance.Value;
            }
        }

        private DisperseTo disperse = DisperseTo.Rectangle;

        public DisperseTo Disperse
        {
            get { return disperse; }
            set { disperse = value; }
        }

        private ShprossConnectorType type;

        public DisperseShprossConnectorForm(ShprossConnectorType shprossConnectorType)
        {
            this.type = shprossConnectorType;
            InitializeComponent();
            switch (type)
            {
                case ShprossConnectorType.X:
                    radioButtonToRectangleAndShprosses.Enabled = true;
                    radioButtonToRectangleAndShprosses.Checked = true;
                    break;
                case ShprossConnectorType.Y:
                    radioButtonDiamondRotateAndShprosses.Enabled = true;
                    radioButtonDiamondRotateAndShprosses.Checked = true;
                    break;                
            }
        }

        private void radioButtonToRectangleAndShprosses_CheckedChanged(object sender, EventArgs e)
        {
            disperse = DisperseTo.RectangleWithShprosses;
        }

        private void radioButtonDiamondRotateAndShprosses_CheckedChanged(object sender, EventArgs e)
        {
            disperse = DisperseTo.DiamondWithShprosses;
        }

        private void radioButtonRectangle_CheckedChanged(object sender, EventArgs e)
        {
            disperse = DisperseTo.Rectangle;
        }

        private void radioButtonDiamond_CheckedChanged(object sender, EventArgs e)
        {
            disperse = DisperseTo.Diamond;
        }
    }
}
